//
//  YeuThichViewController.m
//  NhomThuy
//
//  Created by HOCVIEN on 1/27/15.
//  Copyright (c) 2015 t3h. All rights reserved.
//

#import "YeuThichViewController.h"
#import "YeuThichCell.h"
#import "ManagerData.h"

@interface YeuThichViewController ()

@end
NSString *songName;
@implementation YeuThichViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    self.myTableView.delegate=self;
    self.myTableView.dataSource=self;
    self.myArray = [ManagerData defaultManager].enSongList;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.myArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSString *identifier =@"CellLikeIdentifier";
    YeuThichCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if(!cell) {
        [tableView registerClass:[YeuThichCell class] forCellReuseIdentifier:identifier];
        cell= [tableView dequeueReusableCellWithIdentifier:identifier];
    }
    
    NSDictionary *myDict = [[ManagerData defaultManager].enSongList objectAtIndex:indexPath.row];
    NSLog(@"%@",myDict);
    songName=[myDict objectForKey:@"song-name"];
    cell.SongName.text = [myDict objectForKey:@"song-name"];
    cell.SongLyrics.text = [myDict objectForKey:@"lyrics"];
    cell.SongCode.text = [myDict objectForKey:@"song-code"];
    
    return cell;
}
- (IBAction)BtnLike:(id)sender {
    NSString *content=[NSString stringWithFormat:@"Bạn có đồng ý bỏ thích bài hát %@",songName];
    UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Bỏ thích bài hát"
                                                      message:content
                                                     delegate:nil
                                            cancelButtonTitle:@"OK"
                                            otherButtonTitles:@"Đồng ý", nil];
    
    [message show];
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
